home *** CD-ROM | disk | FTP | other *** search
/ Level 2005 Christmas (DVD) / Level_2005-XMAS_134_DVD_Knightshift.iso / Demos / Ski Racing 2006 / setup1.cab / DataCommonShadersDX9Normal_Specular_1BitAlpha.psh < prev    next >
Encoding:
Text File  |  2005-11-03  |  1.1 KB  |  46 lines

  1. ;Light the skin with a directional lights and a bump map.
  2. ;
  3. ;B  = Base map
  4. ;N  = Per pixel normal from normal map
  5. ;D1 = Light 1 Direction in t2
  6. ;C1 = Light 1 Color in c2
  7. ;AL = Ambient lighting in oD0
  8. ;MC = Material color in oD1
  9. ;Oc = Output color
  10. ;Oa = Output alpha
  11. ;
  12. ;Oc = B * MC * (((N dot D1) * C1) + ((N dot D2) * C2))
  13. ;Oa = 1
  14.  
  15. ps.1.1
  16.  
  17. def c0, 0.0, 0.0, 0.0, 1.0
  18.  
  19. tex  t0                      ;Sample base map
  20. tex  t1                      ;Sample normal map
  21. tex  t2                      ;Sample gloss map
  22. tex  t3                  ; shadowmap (dark channel)
  23.  
  24.  
  25. dp3_sat r1, t1_bx2, v1_bx2        ;half vector dot normal
  26.  
  27. ; exp specular
  28. mul r1, r1, r1
  29. ;mul r1, r1, r1
  30.  
  31. ; modulate gloss
  32. ;mul_sat r1, t1, r1 
  33.  
  34.  
  35. ; N dot L.  Both vectors are biased coming out of the vertex shader.
  36. dp3_sat r0, t1_bx2, v0_bx2   ;N dot L for Light1 - normal shading
  37. mad_sat r0, r0, c2, c1      ;Color for Light1 C3 = dircolor + C2 = ambcolor 
  38.  
  39. ; mul applies the shadow map
  40. ;mul_sat r0, r0, t3 
  41.  
  42. ; add specular component
  43. mad_sat r0, r0, t0, r1
  44. mov r0.a, t0.a
  45.  
  46.